package jmine.tec.hydra.dao;

import java.util.List;

import jmine.tec.hydra.domain.HydraActivation;
import jmine.tec.hydra.domain.HydraSystem;

import org.hibernate.Criteria;
import org.hibernate.criterion.Order;

import bancosys.tec.persist.dao.BaseDAO;
import bancosys.tec.persist.hibernate.RestrictionsUtils;

/**
 * DAO de HydraActivation
 * 
 * @author lundberg
 */
public class HydraActivationDAO extends BaseDAO<HydraActivation> {

    /**
     * Busca todas as ativações do sistema
     * 
     * @param system system
     * @return Lista de HydraActivation
     */
    public List<HydraActivation> findBySystem(HydraSystem system) {
        Criteria criteria = this.createCriteria();
        RestrictionsUtils.addRestrictionEq(criteria, "system", system);
        criteria.addOrder(Order.asc("id"));
        return this.executeQuery(criteria);
    }
}
